package com.cws4cloud.cws.mall.cms.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cws4cloud.cws.common.core.constant.BaseSQLConf;
import com.cws4cloud.cws.common.core.constant.enums.StatusEnum;
import com.cws4cloud.cws.mall.cms.constant.AdvertConstants;
import com.cws4cloud.cws.mall.cms.entity.Advertisement;
import com.cws4cloud.cws.mall.cms.mapper.AdvertisementMapper;
import com.cws4cloud.cws.mall.cms.service.AdvertisementService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 
 *
 * @author zhulj
 * @date 2021-05-10 23:09:36
 */
@Service
public class AdvertisementServiceImpl extends ServiceImpl<AdvertisementMapper, Advertisement> implements AdvertisementService {

	@Override
	public List<Advertisement> getPcAdvertisement(Integer siteId) {
		QueryWrapper<Advertisement> queryWrapper = new QueryWrapper<>();
		queryWrapper.eq(BaseSQLConf.TYPE, AdvertConstants.TYPE_PC_HOME_PAGE);
		queryWrapper.eq(BaseSQLConf.STATUS, StatusEnum.SHOW);
		queryWrapper.eq("location", AdvertConstants.LOCALTION_PC_HOME_SLIDE);
		queryWrapper.eq(BaseSQLConf.SITE_ID, siteId);
		queryWrapper.orderByAsc(BaseSQLConf.SEQUENCE);
		return baseMapper.selectList(queryWrapper);
	}
}
